package com.zx.designpattern.view.activity;

import android.os.Bundle;
import android.widget.ListView;

import com.zx.designpattern.R;
import com.zx.designpattern.view.adapter.TagsAdapter;
import com.zx.designpattern.base.BaseActivity;
import com.zx.designpattern.model.bean.TagMod;
import com.zx.designpattern.presenter.TagsPresenter;
import com.zx.designpattern.view.IBaseView;

import java.util.List;

import butterknife.BindView;

public class TestHttpActivity extends BaseActivity<IBaseView, TagsPresenter<IBaseView>> {

    @BindView(R.id.listview)
    ListView listview;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        basePresenter.fetch();
    }

    @Override
    protected TagsPresenter<IBaseView> createPresenter() {
        return new TagsPresenter<>();
    }

    @Override
    protected int getRootViewId() {
        return R.layout.activity_test_http;
    }

    @Override
    public void showView(int code, Object data) {
        switch (code) {
            case 1://数据展示
                List<TagMod> list = (List<TagMod>) data;
//                text_show.setText("" + text);
                TagsAdapter mAdapter = new TagsAdapter(this, list);
                listview.setAdapter(mAdapter);
                break;
            default:
                break;
        }
    }
}
